<?php

namespace IDock\Insurance\ZYIC\Request;

use IDock\Insurance\ZYIC\Request\AllZYICRequest;
use IDock\Insurance\ZYIC\Response\EPolicyDownloadResponse;
use IDock\Visitor\EPolicyDownloadVisitor;

class EPolicyDownloadRequest extends AllZYICRequest
{
    public $route = 'channelInterface/V19';

    protected $response = EPolicyDownloadResponse::class;

    protected $urlTip = '下载电子保单';

    /**
     * @var  EPolicyDownloadVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $policy = $this->visitor->policyNo;
        $arr = [
            'policyNo' => $policy,
            'certiType' => $this->visitor->argc['type']['certiType'] ?? '',//P:保单
            'systemSource' => 'BH'
        ];
        if($arr['certiType'] == 'F'){
            $this->route = 'channelInterface/V23';
        }
        return $arr;
    }
}
